/*
会变的光
*/
var { Plot } = require("../Plot.js");
/**
 * @type {HTMLCanvasElement}
 */
var canvasDom = document.querySelector("#myCanvas");
var plot = new Plot(canvasDom)

function fillColor() {
    var { context } = plot;
    let { width: w, height: h } = plot.container
    // var a = context.getImageData(0, 0, w, h)
    var a = context.createImageData(w, h)
    var data = a.data
    for (let index = 0, len = data.length; index < len;) {
        var x = index / 4 % h
        var y = ~~(index / 4 / h);
        // console.log({x,y})
        data[index++] = (Math.sin(x * Math.PI * 2 / w ) + 1) * 128
        data[index++] = (Math.sin(y * Math.PI * 2 / h ) + 1) * 128;
        data[index++] = (Math.sin(x * Math.PI * 2 / w ) + 1) * 128;
        data[index++] = 255
    }
    plot.context.putImageData(a, 0, 0);
}

fillColor()










